from PyQt5.QtCore import QObject, pyqtSignal


class People(QObject):
    hp_changed = pyqtSignal(int)
    died = pyqtSignal()

    def __init__(self, speed=800):
        super().__init__()
        self.speed = speed
        self.hp = 100

    def echo_status(self):
        print(f"当前状态：{self.hp}")

    def reduce_hp(self, amount):
        self.hp = max(0, self.hp - amount)
        self.hp_changed.emit(self.hp)
        print(f"生命值减少 {amount}，当前生命值：{self.hp}")
        if self.hp == 0:
            self.died.emit()
            pass
